package com.tasly.concreteComponent;

import com.tasly.component.Drink;

/**
 * ClassName:Decorator
 * Description:
 *
 * @Author 肖宝成
 * @Create 2024/12/19 21:55
 * @Version 1.0
 */
public class Decorator extends Drink {
    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public double cost() {
        return getPrice() + drink.cost();
    }

    @Override
    public String getDesc() {
        return getDesc() + " " + getPrice() + "&&" + drink.getDesc();
    }
}
